//
// Created by chaseaishang on 23-4-8.
//
#include "Render/Renderer.h"
#include "TestClearColor.h"
#include "imgui.h"
#include "Event.h"
#include "KeyEvent.h"

test::TestClearColor::TestClearColor():m_CLearColor{0.2,0.3,0.4,1}
{

}

test::TestClearColor::~TestClearColor() {

}

void test::TestClearColor::OnUpdate(float deltaTime) {

}

void test::TestClearColor::OnRender() {
    GLCall(glClearColor(m_CLearColor[0],m_CLearColor[1],m_CLearColor[2],m_CLearColor[3]));
    GLCall(glClear(GL_COLOR_BUFFER_BIT));
}

void test::TestClearColor::OnImGuiRender() {
    ImGui::ColorEdit4("Clear_color", m_CLearColor);

}

void test::TestClearColor::OnEvent(Event &e) {
    if(e.IsInCategory(EventCategory::EventCategoryApplication))
    {
        return;
    }
    EventDispatcher dispatcher(e);
    dispatcher.Dispatch<KeyPressedEvent>(
            [&](KeyPressedEvent&e)
            {
                
                return true;
            }
    );
    dispatcher.Dispatch<KeyReleasedEvent>(
            [&](KeyReleasedEvent&e)
            {

                return true;
            }
    );
//KeyPressedEvent
//KeyReleasedEvent
}
